<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"

      xmlns:c="http://java.sun.com/jsp/jstl/core">
    <ui:composition template="./WEB-INF/includes-templates/template.xhtml">
        <ui:param name="pageTitle" value="#{trans.system_name}" />
        <ui:define name="content" >
            <ui:include src="/WEB-INF/includes/searchBar.xhtml" />
            <h3>#{trans.b_schoolMat}</h3>
            <br />
            <h:form>
                <h5><h:link outcome="schoolMat">#{trans.year} #{schoolmat.mat.year}</h:link> |
                    <p:commandLink  action="#{year.pickYear(schoolmat.mat.year)}" >#{trans.subject}</p:commandLink> | #{schoolmat.mat.subject.name}</h5>

            </h:form>

            <h:form>  
                <p:dataTable var="mat" value ="#{schoolmat.selectedSchoolMat}">  
                    <p:column headerText="#{trans.name}">  
                        <h:outputText value="#{mat.name}" />  
                    </p:column>
                    <p:column headerText="#{trans.week}">  
                        <h:outputText value="#{mat.week}" />  
                    </p:column> 
                    <p:column headerText="#{trans.createDate}">  
                        <h:outputText value="#{mat.createDat}" >
                            <f:convertDateTime type="date" pattern="dd.MM.yyyy"/>
                        </h:outputText>
                    </p:column> 
                    <p:column headerText="#{trans.lastChange}">  
                        <h:outputText value="#{mat.lastChange}"  >
                            <f:convertDateTime type="date" pattern="dd.MM.yyyy"/>
                        </h:outputText>  
                    </p:column> 
                    <p:column headerText="#{trans.comments}">  
                        <h:outputText value="#{mat.comments}" />  
                    </p:column> 
                    <p:column headerText="#{trans.notes}">  
                        <h:outputText value="#{mat.notes}" />  
                    </p:column> 


                    <p:column headerText="#{trans.rate}">  
                        <p:rating value="#{schoolmat.ratingInt()}"  readonly="true"/>
                    </p:column> 

                    <p:column style="width:4%">  
                        <p:commandButton id="selectButton" icon="ui-icon-search" title="View" ajax="false" 
                                         action="#{reader.openEditor(mat)}" onclick="this.form.target='_blank'">  

                        </p:commandButton>  
                    </p:column>


                </p:dataTable> 
                
            </h:form>  

        </ui:define>
    </ui:composition>

</html>
